package com.puppy.controller;

import com.puppy.pojo.JobOption;
import com.puppy.pojo.Result;
import com.puppy.service.ReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/reports")
public class ReportController {
    @Autowired
    private ReportService reportService;

    /*统计员工职位人数*/
    @GetMapping("/empJobData")
    public Result getEmpJobCount(){
        log.info("统计员工职位人数");
        JobOption jobOption = reportService.getEmpJobCount();
        return Result.success(jobOption);
    }

    /*统计员工性别人数*/
    @GetMapping("/empGenderData")
    public Result getEmpGenderCount(){
        log.info("统计员工性别人数");
//        {"name":"男性员工","value":"1"} map<,>
//        {"name":"女性员工","value":"1"} map<,>
        List<Map<String,Object>> genderList = reportService.getEmpGenderCount();
        return Result.success(genderList);
    }

}
